package com.github.lee.unsplash.ui.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.github.lee.unsplash.ui.account.AccountFragment
import com.github.lee.unsplash.ui.home.HomeFragment
import com.github.lee.unsplash.ui.topic.TopicFragment

class MainPageAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
    override fun getItemCount(): Int = 3

    override fun createFragment(position: Int): Fragment =
        when (position) {
            0 -> HomeFragment.newInstance()
            1 -> TopicFragment.newInstance()
            2 -> AccountFragment.newInstance()
            else -> HomeFragment.newInstance()
        }


}